<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>拼游反馈列表</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>

    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <style>
        #grouptours tr th,td{
            text-align:center
        }
    </style>
</head>

<body>
<div class="layui-fluid main">
    <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">
        <div class="layui-form-item" style="float: left;">
            <form class="layui-form serch" action="/admin/grouptoursline/grouptourfeedbacklist" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <input type="text" name="content" lay-verify="content" value="{if isset($wherelist['content'])}{$wherelist['content']}{/if}" autocomplete="off" placeholder="请输入邮箱地址/反馈内容" class="layui-input layui-btn-sm">
                    </div>
                    <div class="layui-input-inline">
                        <div class="layui-inline">
                            <select name="status" lay-search="">
                                <option value="">状态</option>
                                <option value="0" {if isset($wherelist['status'])&&$wherelist['status']=='0'}selected{/if}>未读</option>
                                <option value="1" {if isset($wherelist['status'])&&$wherelist['status']=='1'}selected{/if}>已读</option>
                            </select>
                        </div>
                    </div>
                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                    <!--<a href="{:url('admin/grouptoursline/edit')}" class="layui-btn layui-btn-sm a_menu">-->
                        <!--<i class="layui-icon layui-icon-add-1">+</i>普通拼线路-->
                    <!--</a>-->
                    <!--<a href="{:url('admin/grouptoursline/editFree')}" class="layui-btn layui-btn-sm layui-btn-warm a_menu">-->
                        <!--<i class="layui-icon layui-icon-add-1">+</i>自由拼线路-->
                    <!--</a>-->
                </div>
            </form>

        </div>
    </fieldset>
    <table class="layui-table" lay-even="" lay-skin="line" id="grouptours">
        <colgroup>
            <col width="50">
            <col width="100">
            <col width="400">
            <col width="80">
            <col width="80">
            <col width="80">
        </colgroup>
        <thead>
        <tr>
            <th >ID</th>
            <th >邮箱地址</th>
            <th >反馈内容</th>
            <th >状态</th>
            <th >创建时间</th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr>
            <td>{$vo.id}</td>
            <td>{$vo.email}</td>
            <td>{$vo.feedback_content}</td>

            <td>
                <form class="layui-form" action="">
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin:10px">
                            <input type="checkbox" name="status" value="1" data-id="{$vo.id}" lay-filter="changeStatus" lay-skin="switch" <?php if($vo['status']==1){ echo 'checked';} ?> lay-text="已读|未读">
                        </div>
                    </div>
                </form>
            </td>
            <td>{$vo.create_time}</td>
            <td class="operation-menu">
                <a class="layui-btn layui-btn-xs layui-btn-danger delete" codeid="{$vo.id}" style="margin-right: 0;margin-top:2px;font-size:12px;margin-bottom:4px">删除</a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div>{$list->render()}</div>
    <script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script type="text/javascript">
        layui.use(['layer','form'],function(){
            var layer = layui.layer;
            var form = layui.form;
            $('.a_menu').click(function(){
                var url = $(this).attr('href');
                var a = 0;
                $.ajax({
                    url:url
                    ,async:false
                    ,success:function(res){
                        if(res.code == 0) {
                            layer.msg(res.msg);
                            a = 1;
                        }
                    }
                });
                if(a === 0) {
                    layer.open({
                        type:2,
                        content:url,
                        area: ['60%', '90%'],
                        end:function(){
                            location.reload();
                        }
                    });
                }
                return false;
            });
            //切换禁用启用
            form.on('switch(changeStatus)', function(data){
                var id= $(this).attr('data-id')
                var is_recommend;

                if(data.elem.checked){
                    $status =1;
                }else{
                    $status =0;
                }
                $.ajax({
                    url:"{:url('admin/grouptoursline/changefeedbackstatus')}",
                    data:{'id':id,'status':$status},
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                    }
                })

            });
        });
        $('.delete').click(function(){
            var id = $(this).attr('codeid');
            layer.confirm('确定要删除?', function(index) {
                $.ajax({
                    url:"{:url('admin/grouptoursline/delfeedback')}",
                    data:{id:id},
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                location.reload();
                            },1500)
                        }
                    }
                })
            })
        })
    </script>
</div>
</body>
</html>
